<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app"></div>

    <script src="../../00_课程资料/js@17.0.2/react.development.js"></script>
    <script src="../../00_课程资料/js@17.0.2/react-dom.development.js"></script>
    <script src="../../00_课程资料/js@17.0.2/babel.min.js"></script>

    <script type="text/babel">
        class Person extends React.Component{
            state = {
                count:0
            }
            add = ()=>{
                let {count} = this.state
                count++
                this.setState({
                    count:count
                })
            }
            render(){
                const {count} = this.state
                return(
                    <div>
                        <h3>数据和是：{count}</h3>    
                        <button onClick={this.add}>增加</button>
                    </div>
                )
            }
            componentDidMount(){
                console.log('页面加载完成');
            }
            componentDidUpdate(){
                console.log('页面更新完成');
            }
        }
        ReactDOM.render(<Person/>,document.getElementById('app'))
    </script>
</body>

</html>